package com.ydh.custom.loading;

import android.content.Context;
import android.util.DisplayMetrics;
import android.view.WindowManager;

public class ParamsCreator {

    private Context context;
    private int screenWidth;//屏幕宽度
    private int screenHeight;//屏幕高度
    private int densityDpi;//像素密度

    public ParamsCreator(Context context) {
        this.context = context;
        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        screenWidth = wm.getDefaultDisplay().getWidth();
        screenHeight = wm.getDefaultDisplay().getHeight();
        DisplayMetrics metric = new DisplayMetrics();
        wm.getDefaultDisplay().getMetrics(metric);
        densityDpi = metric.densityDpi;
    }

    /**
     * 获得默认圆的半径
     */
    public int getDefaultCircleRadius() {
        if (screenWidth >= 1400) {//1440
            return 50;
        }
        if (screenWidth >= 1000) {//1080
            return 48;
        }
        if (screenWidth >= 700) {//720
            return 34;
        }
        return 30;
    }

    /**
     * 获得默认圆的间距
     */
    public int getDefaultCircleSpacing() {
        if (screenWidth >= 1400) {//1440
            return 12;
        }
        if (screenWidth >= 700) {//720
            return 8;
        }
        return 5;
    }
}
